package com.yunhe.ssm.mybatis.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.yunhe.ssm.mybatis.dao.StudentDao;
import com.yunhe.ssm.mybatis.model.Page;
import com.yunhe.ssm.mybatis.model.Soccer;
import com.yunhe.ssm.mybatis.model.StudentModel;
import com.yunhe.ssm.mybatis.model.Teacher;
import com.yunhe.ssm.mybatis.service.IStudentService;
@Service
public class StudentServiceImpl implements  IStudentService{
	@Autowired
	private StudentDao student;
	

	public StudentModel loginStu(StudentModel stu) {
		
		return student.loginStu(stu);
		
	}

	@Override
	public StudentModel getStudentById(StudentModel stu) {
		
		return student.getStudentById(stu);
	}

	@Override
	public Soccer getSoccerById(StudentModel stu) {
		
		return student.getSoccerById(stu);
	}

	@Override
	public List<Teacher> getTeacherByStu(StudentModel stu) {
		
		return student.getTeacherByStu(stu);
	}

	@Override
	public Page getStudentPage(Map<String, Object> cond) {
		Page page=new Page();
		page.setTotalnum(student.getStudentTotal());
		int pageSize = Integer.parseInt(String.valueOf(cond.get("pageSize")));
		int curPageNum = Integer.parseInt(String.valueOf(cond.get("pageNum")));
		page.setCurpage(curPageNum);
		page.setPagesize(pageSize);
		page.setResult(student.getStudentPage(page));
		return page;
	}

	@Override
	public void studentUp(StudentModel stu) {
		student.studentUp(stu);
		
	}

	@Override
	public void stuUpwd(StudentModel stu) {
		student.stuUpwd(stu);

	}

	@Override
	public StudentModel finPwdById(StudentModel stu) {
		
		return student.findpwd(stu);
	}


}
